package com.cj.gateway;

import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import reactor.core.publisher.Mono;

/**
 * @Author cheng jun
 * @Description:
 * @Date 2021/5/26 19:31
 */
@Configuration
public class KeyResolverConfiguration {

    /**
     * 基于路径
     * @return
     */
    @Bean
    public KeyResolver pathKeyResolver(){
        return exchange -> Mono.just(
                exchange.getRequest().getPath().toString());
    }
}
